package com.jml.oom;


import java.nio.ByteBuffer;
import sun.misc.VM;

/**
 * @author:jml
 * @date: 2019/5/8 18:20
 * @description：
 */
public class DirectBufferMemoryDemo {

    //-Xms5m -Xmx5m -XX:+PrintGCDetails -XX:MaxDircetMemorySize=5m
    public static void main(String[] args) throws InterruptedException {
        double directMemory = VM.maxDirectMemory() / (double) 1024 / 1024;
        System.out.println(directMemory+"MB");
        Thread.sleep(3000);
        ByteBuffer byteBuffer=ByteBuffer.allocateDirect(6*1024*1024);
    }
}
